//============================================================================
// Name        : duong.cpp
// Author      : bt
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <stdio.h>
using namespace std;

void openinfile(ifstream&infile)
{
	char filename[200];
	cout<<"Enter the file name: ";
	cin>>filename;
	infile.open(filename);
}
int main() {

		   ifstream inputfile;
	       ofstream outputfile;
	       char chs;
	       openinfile(inputfile);
	       outputfile.open("/home/olovei/workspace/duong/bt.txt");
	       while (inputfile.eof()==NULL)

	       {
	              inputfile.get(chs);
	              if (inputfile.eof()==NULL)
	              {
	                  cout<<chs;
	                  outputfile<<chs;
	              }
	       }
	       cout<<"\nReading and writing file is completed!"<<endl;
	       inputfile.close();
	       outputfile.close();
	       return 0;
}
